// 商户中心>运营商
import React, { useState, useEffect } from 'react'
import { Col, Form, Input, Button, Row, message, } from 'antd'
import { PageHeaderWrapper } from '@ant-design/pro-layout'
import RenderButtom from '@/components/RenderButton'
import SearchBox from '@/components/SearchBox'
import { formItemLayout } from '@/utils/utils'
import { bindBankCard, delBankCard, getBankCardInfo } from '@/services/dataCenter/financeData'

const SettleAccount = props => {
  const { form } = props
  const { getFieldDecorator } = form
  const [data, setData] = useState({})

  useEffect(() => {
    init()
  }, [])

  const init = async params => {
    const res = await getBankCardInfo()
    setData(res.data)
  }

  // 表单查询
  const handleSearch = e => {
    e.preventDefault()
    form.validateFields((err, values) => {
      console.log('Received values of form: ', values)

    })
  }
  // 按钮处理
  const handleBtn = type => {
    switch (type) {
      case 3: // edit
        return editData(event)
      default:
        break;
    }
  }


  const formItemLay_1 = {
    labelCol: { span: 4 },
    wrapperCol: { span: 10 },
  }

  return (<PageHeaderWrapper>
    <Form {...formItemLayout}>
      <Form.Item label={`姓名`} {...formItemLay_1}>
        {getFieldDecorator('name', {
          rules: [{
            required: true,
            message: '必须输入姓名',
          }],
        })(<Input placeholder="输入优惠券名称" />)}
      </Form.Item>
      <Form.Item label={`身份证号码`} {...formItemLay_1}>
        {getFieldDecorator('pid', {
          rules: [{
            required: true,
            message: '必须输入身份证号码',
          }],
        })(<Input placeholder="输入身份证号码" />)}
      </Form.Item>
      <Form.Item label={`银行卡号`} {...formItemLay_1}>
        {getFieldDecorator('bankCard', {
          rules: [{
            required: true,
            message: '必须输入银行卡号',
          }],
        })(<Input placeholder="输入优惠券名称" />)}
      </Form.Item>
      <Form.Item label={`手机号码`} {...formItemLay_1}>
        {getFieldDecorator('phone', {
          rules: [{
            required: true,
            message: '必须输入手机号码',
          }],
        })(<Input placeholder="输入手机号码" />)}
      </Form.Item>
    </Form>
    <RenderButtom click={handleBtn} />
  </PageHeaderWrapper>)
}

export default Form.create()(SettleAccount)
